//#include <stdio.h>
//#include <stdlib.h>

//#include "hmac_sha1.h"
//#include "../sysdef.h"
#include "../os_common.h"


VOID PRF(UCHAR *key, 	UINT key_len,
         UCHAR *prefix, UINT prefix_len,
         UCHAR *data, 	UINT data_len,
         UCHAR *output, UINT len)
{
	UINT i;
	UCHAR input[1024]; /* concatenated input */
	UINT currentindex = 0;
	UINT total_len;
	
	OS_MEMORY_COPY(input, prefix, prefix_len);
	input[prefix_len] = 0; /* single octet 0 */
	
	OS_MEMORY_COPY(&input[prefix_len + 1], data, data_len);
	
	total_len = prefix_len + 1 + data_len;
	input[total_len] = 0;	/* single ocete count, starts at 0 */
	total_len++;
	
	for (i=0; i < (len+19)/20; ++i)
	{
		hmac_sha1(input, total_len, 
		          key,   key_len,
		          &output[currentindex]);
		currentindex += 20; /* next concatenation location */
		input[total_len-1]++; /* increment octet count */
	}
}

#define BUFLEN 4096


